/**
 * @param {string} J
 * @param {string} S
 * @return {number}
 */
var numJewelsInStones = function(J, S) {
  var re = new RegExp("[" + J + "]", "g")
  var tmp = S.replace(re, "")

  return S.length - tmp.length
}

console.log(numJewelsInStones("aA", "aAAbbbb"))
